class Solution:
    def longestDecomposition(self, text: str) -> int:
        if not text:
            return 0
        size = len(text)
        for i in range(1, size // 2 + 1):
            if text[:i] == text[-i:]:
                return 2 + self.longestDecomposition(text[i:-i])
        return 1


if __name__ == "__main__":
    # 7
    print(Solution().longestDecomposition(text="ghiabcdefhelloadamhelloabcdefghi"))

    # 1
    print(Solution().longestDecomposition(text="merchant"))

    # 11
    print(Solution().longestDecomposition(text="antaprezatepzapreanta"))

    # 3
    print(Solution().longestDecomposition(text="aaa"))

    # 测试用例45/83
    print(Solution().longestDecomposition(text="elvtoelvto"))
